<%@page import="bean.Advertisement"  %>
<%@page import="bean.CartItem"  %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%@ include file="/title.html" %>
</head>
<body>
<table width="100%">
<%@ include file="/header.jsp" %>

<tr valign="top"><td align="center" height="300px">
<table width="100%">

<tr valign="top" height="50px">
<td align="center">
<%@ include file="/headerLinks.jsp" %>
</td>
</tr>
<tr><td align="center" height="40px" colspan="2" valign="top"><h3>My Advertisement</h3></td></tr>
<% if(request.getAttribute("message") != null) { %>
<tr><td align="center" style="color:red"><%= request.getAttribute("message") %></td></tr>
<% } %>

<%if(null != request.getAttribute("Advertisement")) { 
%>	
<tr>
	<td align="center">
	<table  width="70%" style="text-align:left">
		<tr>
			<td>No.</td>
			<td>Item</td>
			<td>Description</td>
			<td>Seller Information</td>
			<td>Price</td>
			<td>Available Quantity</td>
			<td></td>
		</tr>
<% if(null != request.getAttribute("Advertisement")) { 
		Advertisement aoAdvert[] = (Advertisement[])request.getAttribute("Advertisement");
		for(int i=0;i<aoAdvert.length;i++) { %>
		

	<form name="update_<%=aoAdvert[i].getItemId()%>" action="UpdateMyAdvertisement" method="post">
		<tr>
			<td><%=i+1%></td>
			<td><%=aoAdvert[i].getItemName() %></td>
			<td><%=aoAdvert[i].getItemDescription() %></td>
			<td><%=aoAdvert[i].getSellerInfo() %></td>
			<td><%=aoAdvert[i].getItemPrice() %></td>
			<td><input type="text" name="itemQuantity" value="<%=aoAdvert[i].getItemQuantity() %>"></td>
			<td>				
				<input type="submit" name="submit" value="Update">
				<input type="submit" name="submit" value="Delete">
				<input type="hidden" name="itemId" value="<%=aoAdvert[i].getItemId()%>">
			</td>
			
		</tr>
	</form>		
<%	}
		}
		}%>
	</table>
	</td>
</tr>


</table>
</td>
</tr>

<%@ include file="/bottom.html" %>
</table>
</body>
</html>